package com.aaa.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@MapperScan(basePackages = "com.aaa.order.dao")
public class OrderApp {
    public static void main(String[] args) {
        SpringApplication.run(OrderApp.class,args);
    }

    @Bean
    @LoadBalanced //告诉RestTemplate使用ribbon完成负载均衡。---自动从注册中心拉取服务。--内置的负载均衡策略完成服务的调用。
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}